package 算法;

import java.util.Arrays;
import java.util.Comparator;

public class lambda {
    public static void main(String[] args) {
//     lambda表达式
        Integer[]arr={5, 6, 20, 3, 94, 25, 30, 25, 1, 3, 9};
/*
        Arrays.sort(arr, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o1-o2;
            }
        });
        System.out.println(Arrays.toString(arr));
        */

        Arrays.sort(arr,(Integer o1, Integer o2 )->{
                return o1-o2;
            }
        );//以上就为lambda表达式
        System.out.println(Arrays.toString(arr));
    }
}
